const { ccclass, property } = cc._decorator;
import EventMgr from "./EventMgr";
import GameEventType from "./GameEventType";
import frameworkManager from "./frameworkManager";
import AdManager from "./AdManager";
import BasePageCtrl, { AnimType } from "./BasePageCtrl";
import PeripheralSystemMgr, { TravelEvent } from "./PeripheralSystemMgr";
import UiManage from "./UiManage";
import HotAirBallonPage from "./HotAirBallonPage";
import NativeUtils from "./NativeUtils";

@ccclass
export default class HotAirBallonPageCtrl extends BasePageCtrl {

    onLoad() {
        this.onUILoad();
        this._animType = AnimType.SCALE;
        this._touchControl = false;
        this._hasPeneLock = true;
        this._hasBlack = true;
        this._hasTouchLock = false;
        this._hasBlackTouch = false;
        super.onLoad();
        this.addButtonListen();
    }

    onUILoad() {
        this.ui = this.node.addComponent(HotAirBallonPage);
    }

    addButtonListen() {
        UiManage.addButtonListen(this.ui.btn_close, this.clickClose, this);
        UiManage.addButtonListen(this.ui.btn_video, this.clickVideo, this);
    }

    clickClose() {
        EventMgr.trigger(GameEventType.BLLON_SHOW_STATE);
        this.hide();
    }

    clickVideo() {
        console.log("播放视频======");
        NativeUtils.showVideoAd(7,() => {
            this.hide();
            PeripheralSystemMgr.getVideoReward(TravelEvent.HOTAIRBALLON, 1, () => { });
        });
    }

    static prefabUrl = "HotAirBallonPage";
    static className = "HotAirBallonPageCtrl";

}
